$4 = 27
+Some Helpful .gdbinit Commands
+------------------------------
+
+define setup
+ file .../install/boot/xen-syms
+ add-sym .../install/boot/vmlinux-syms-2.4.26-xen0
+ add-sym /homes/aho/a.out
+end
+document setup
+ load symbols for xen, xenolinux (dom 0), and "a.out"
+end
+
+define setup-linux
+ set pdb_pidhash_addr = &pidhash
+ set pdb_init_task_union_addr = &init_task_union
+
+ set task_struct_mm_offset = (void *)&(init_task_union.task.mm) - (void *)&(init_task_union.task)
+ set task_struct_next_task_offset = (void *)&(init_task_union.task.next_task) - (void *)&(init_task_union.task)
+ set task_struct_pid_offset = (void *)&(init_task_union.task.pid) - (void *)&(init_task_union.task)
+ set task_struct_pidhash_next_offset = (void *)&(init_task_union.task.pidhash_next) - (void *)&(init_task_union.task)
+ set task_struct_comm_offset = (void *)&(init_task_union.task.comm) - (void *)&(init_task_union.task)
+ set task_struct_comm_length = sizeof (init_task_union.task.comm)
+
+ set mm_struct_pgd_offset = sizeof (struct vm_area_struct *) * 2 + sizeof (rb_root_t)
+end
+document setup-linux
+ define various xenolinux specific offsets and sizes in pdb
+end
+
+
Changes
-------
+04.07.15 aho .gdbinit
04.02.05 aho creation
04.03.31 aho add description on debugging multiple domains
#include <xen/serial.h>
#include <xen/softirq.h>
-#undef PDB_DEBUG_TRACE
+#define PDB_DEBUG_TRACE
#ifdef PDB_DEBUG_TRACE
#define TRC(_x) _x
#else
int pdb_change_values_one_page(u_char *buffer, int length,
unsigned long cr3, unsigned long addr, int rw)
{
- l2_pgentry_t* l2_table = NULL;
- l1_pgentry_t* l1_table = NULL;
- u_char *page;
+ l2_pgentry_t* l2_table = NULL; /* page directory */
+ l1_pgentry_t* l1_table = NULL; /* page table */
+ u_char *page; /* 4k page */
int bytes = 0;
l2_table = map_domain_mem(cr3);
unsigned long pdb_pidhash_addr = 0xc01971e0UL;
unsigned long pdb_init_task_union_addr = 0xc0182000UL;
-#define task_struct_mm_offset 0x2c
-#define task_struct_next_task_offset 0x48
-#define task_struct_pid_offset 0x7c
-#define task_struct_pidhash_next_offset 0xb0
-#define task_struct_comm_offset 0x23e
-#define task_struct_comm_length 0x10
-
-#define mm_struct_pgd_offset 0x0c
+
+unsigned int task_struct_mm_offset = 0x2c;
+unsigned int task_struct_next_task_offset = 0x48;
+unsigned int task_struct_pid_offset = 0x7c;
+unsigned int task_struct_pidhash_next_offset = 0xb0;
+unsigned int task_struct_comm_offset = 0x23e;
+unsigned int task_struct_comm_length = 0x10;
+
+unsigned int mm_struct_pgd_offset = 0x0c;
/*
* find the task structure of a process (pid)